{extend name="public/info_base"}

{block name="title"}
{if $data->id neq 343}
湖南省酒业协会 - {$data->category->name}
{else}
{$data->title}
{/if}
{/block}

{block name="style"}
<link rel="stylesheet" href="__STATIC__/home/css/jquery-weui.min.css">
<link rel="stylesheet" href="__STATIC__/home/css/summary.css">
{/block}

{block name="body"}
<div class="articleList-big">
    {include file="public/header" /}
    {include file="public/nav" /}
    {include file="public/banner" /}
    <div class="main">
        <div class="summary_lf">
            <ul>
                <li class="bg-9d">地州频道</li>
                {volist name="cate" id="vo"}
                <li class="{eq name='vo.id' value='$data.category_id'}bg-9d0{/eq}"><a href="{:url('index', ['cid' => $vo['id'], 'pid' => $vo['pid']])}">{$vo.name}</a></li>
                {/volist}
                <a href="" class="summary_a"><img src="__STATIC__/home/images/mao1.png" alt=""/></a>
                <a href="" class="summary_a"><img src="__STATIC__/home/images/mao1.png" alt=""/></a>
            </ul>
        </div>
        <div class="summary_rt">
            <div class="summary_rt_a">
                <div class="toRight"></div>
                <div class="summary_rt_top">
                    <span class="top_san"></span>
                    <span>当前位置 : </span>
                    <span>首页 </span>
                    <span class="cl-9d">&gt;  {$data->category->name} </span>
                    <span>&gt; </span>
                </div>
            </div>
            <!--常规-->
            <div class="top_two active">
                <span class="top_two_img"></span>
                <span class="cl-9d">{$data.title} </span>
            </div>
            <div class="main_detail">
                <div class="title">
                    <h2>{$data.title}</h2>
                </div>
                <div class="info"> <small>时间:</small>{$data.create_time|date="Y-m-d", ###} <small>作者:</small>{$data.author|default="hnjx"} <small>点击:</small>
                    <script src="/plus/count.php?view=yes&amp;aid=360&amp;mid=2" type="text/javascript" language="javascript"></script>{$data.hits}
                    次</div>

                <div class="intro">
                    {$data.articleDesc.desc}
                </div>

                <div class="content">
                    {$data.articleDesc.content}
                </div>

                <div class="boxoff"> <strong></strong> </div>
                <div class="handle">
                    <div class="context">
                        <ul>
                            <li>上一篇：<a href="{:url('info', ['id' => $previous_posts['id']])}">{$previous_posts.title}</a> </li>
                            <li>下一篇：<a href="{:url('info', ['id' => $next_chapter['id']])}">{$next_chapter.title}</a> </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="clear"></div>
    {include file="public/footer" /}
</div>
<div class="articleList-little">
    <div class="articleList-little_top">
        <span>湖南酒业 </span>
        <span class="cl-9d">&gt;  {$data->category->name} </span>
    </div>
    <div class="main_detail">
        <div class="title">
            <h2>
                {$data.title}
            </h2>
        </div>
        <div class="info"> <small>时间:</small>{$data.create_time|date="Y-m-d", ###} <small>作者:</small>{$data.author} <small>点击:</small>
            <script src="/plus/count.php?view=yes&amp;aid=360&amp;mid=2" type="text/javascript" language="javascript"></script>{$data.hits}
            次
        </div>
        <div class="content viewImage">
            {$data.articleDesc.content}
        </div>
        <div style="width: 7rem; height:7rem; display: block; margin: 1rem auto;" >
            <img src="__STATIC__/home/images/top5.png"/>
        </div>

        <div class="weui-cell">
            <div class="weui-cell__bd">
                <p style="font-size: 15px;color: #007D3F">特别推荐</p>
            </div>
        </div>
        {volist name="recommend" id="vo"}
        <div class="weui-cell weui-cell_access">
            <div class="weui-cell__bd">
                <p><a target="_blank" href="{:url('info', ['id' => $vo['id']])}">{$vo.title}</a></p>
            </div>
            <div class="weui-cell__ft">
            </div>
        </div>
        {/volist}
    </div>
</div>
{/block}

{block name="javascript"}

{notempty name="signPackage"}
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
    $(function(){
        $('.main_detail img').css({
            width: '100%',
            height: 'auto'
        })
        $('.logo_img>img').css({
            width: '118px',
            height: 'auto'
        })
        $(function(){
            $('.flicker-example').flicker();
        });
        $([src='/image/addon.gif']).css({
            width: '1rem',
            height: 'auto'
        })
    })
    wx.config({
        //debug: true,
        appId: '{$signPackage.appId}',
        timestamp: {$signPackage.timestamp},
        nonceStr: '{$signPackage.nonceStr}',
        signature: '{$signPackage.signature}',
        jsApiList: [
            // 所有要调用的 API 都要加到这个列表中
            'checkJsApi',
            'onMenuShareTimeline',
            'onMenuShareAppMessage',
            'hideMenuItems'
        ]
    });
    wx.ready(function () {
        // 在这里调用 API
        wx.checkJsApi({
            jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'hideMenuItems'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
            success: function(res) {
//                alert(res.checkResult.onMenuShareTimeline);
//                alert(res.errMsg);
                //console.log(res);
                // 以键值对的形式返回，可用的api值true，不可用为false
                // 如：{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
            }
        });

        wx.onMenuShareTimeline({
            title: '{$data.title}', // 分享标题
            desc : `{$data.articleDesc.desc}`,
            link: window.location.href, // 分享链接
            imgUrl: 'http://'+window.location.host+'/{$data.image|default="static/home/images/lo_03.png"}', // 分享图标
            success: function () {
                alert('成功');
                // 用户确认分享后执行的回调函数
            },
            cancel: function () {
                alert('取消');
                // 用户取消分享后执行的回调函数
            }
        });

        wx.onMenuShareAppMessage({
            title: '{$data.title}', // 分享标题
            desc : `{$data.articleDesc.desc}`,
            link: window.location.href, // 分享链接
            imgUrl: 'http://'+window.location.host+'/{$data.image|default="static/home/images/lo_03.png"}', // 分享图标
            type: '', // 分享类型,music、video或link，不填默认为link
            dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
            success: function () {
                alert('成功');
                // 用户确认分享后执行的回调函数
            },
            cancel: function () {
                alert('取消');
                // 用户取消分享后执行的回调函数
            }
        });
        wx.hideMenuItems({
            menuList: ['menuItem:share:qq', 'menuItem:share:weiboApp', 'menuItem:favorite', 'menuItem:share:QZone', "menuItem:copyUrl", 'menuItem:openWithQQBrowser', 'menuItem:share:email', 'menuItem:openWithSafari'] // 要显示的菜单项，所有menu项见附录3
        });
    });
</script>
{/notempty}

<script>
    $(function () {
        $('.main_detail img').css({
            width: '100%',
            height: 'auto'
        })
        $('.logo_img>img').css({
            width: '118px',
            height: 'auto'
        })
        $(function(){
            $('.flicker-example').flicker();
        });
        $([src='/image/addon.gif']).css({
            width: '1rem',
            height: 'auto'
        });

        var viewImage_img=$('.viewImage img');
        var viewImageLength=viewImage_img.length;
        console.log(viewImage_img)
        for (var i = 0; i < viewImageLength; i++) {
            viewImage_img[i].setAttribute("data-img", i);

        }
        console.log(viewImageLength);
        $('.viewImage').on('click','img',function (e) {
            e.preventDefault();
            var imgmain=[];
            var tt=$(this).parents('.viewImage').find('img');
            var countActive=$(this).attr('data-img');
            countActive=parseFloat(countActive);
            var count=tt.length;

            console.log($(this).index());

            for (var i=0;i<count;i++){
                imgmain.push(tt[i].src);
            }

            var pb1 = $.photoBrowser({
                items:imgmain,
                onSlideChange: function(index) {
                    console.log(index)
                },
                onOpen: function() {

                },
                onClose: function() {

                },
                initIndex:countActive
            });
            pb1.open();
            $(`.weui-photo-browser-modal.weui-photo-browser-modal-visible .swiper-wrapper .swiper-slide:nth-of-type(${countActive+1})`).addClass('swiper-slide-active')
        });
    })

</script>
{/block}